Developer Documentation

QuickTime 4 API Documentation

Wired Movies and Sprites

| Previous | Chapter Contents | Chapter Top | Next |

Setting Up the Sprite Track's Properities

Listing 3-17 shows a code fragment that sets the sprite track's background color, idle event frequency and its hasActions properties.

Listing 17 Setting the background color, idle event frequency and hasActions properties of the sprite track

// set the sprite track properties
    {
        QTAtomContainer     myTrackProperties;
        RGBColor            myBackgroundColor;
        
        // add a background color to the sprite track
        myBackgroundColor.red = EndianU16_NtoB(0x8000);
        myBackgroundColor.green = EndianU16_NtoB(0);
        myBackgroundColor.blue = EndianU16_NtoB(0xffff);
        
        QTNewAtomContainer(&myTrackProperties);
        QTInsertChild(myTrackProperties, 0,
                        kSpriteTrackPropertyBackgroundColor, 1, 1,
                        sizeof(RGBColor), &myBackgroundColor, NULL);

// tell the movie controller that this sprite track has actions
        hasActions = true;
        QTInsertChild(myTrackProperties, 0,
                        kSpriteTrackPropertyHasActions, 1, 1,
                    sizeof(hasActions), &hasActions, NULL);
    
        // tell the sprite track to generate QTIdleEvents
        myFrequency = EndianU32_NtoB(60);
        QTInsertChild(myTrackProperties, 0,
                        kSpriteTrackPropertyQTIdleEventsFrequency, 1, 1,
                            sizeof(myFrequency), &myFrequency, NULL);
        myErr = SetMediaPropertyAtom(myMedia, myTrackProperties);
        if (myErr != noErr)
            goto bail;

        QTDisposeAtomContainer(myTrackProperties);
    }


© 1999 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |